package com.mgm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.mgm.kafka.service.KafkaProducerService;
import com.mgm.test.KafkaSendMsgUtils;

/**
 * @author: hsc
 * @date: 2018/6/19 14:44
 * @description 文件描述
 */

@RestController
@RequestMapping(value = "/kafka")
public class KafkaController {

	@Autowired
	private KafkaProducerService kafkaProducerService;
	
    @RequestMapping(value = "/producer" , method = RequestMethod.GET)
    public void producer(){
    	
    	for (int i = 0; i < 10; i++) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            kafkaProducerService.sendMessageDefault("key","kafka-test...kafka-test----kafka-test=========kafka-test");
        }
    	
    }
}